#ifndef __AT_COMMAND_H__
#define __AT_COMMAND_H__

#include "config.h"

#define param_str_len 192
#define param_count_max 16
#define str2int_size 16

typedef enum
{
    AT_CMD_MODE_READ,      /**< Read mode command, such as "AT+CMD?". */
    AT_CMD_MODE_ACTIVE,    /**< Active mode command, such as "AT+CMD". */
    AT_CMD_MODE_EXECUTION, /**< Execute mode command, such as "AT+CMD=<op>". */
    AT_CMD_MODE_TESTING,   /**< Test mode command, such as "AT+CMD?=<op>". */
    AT_CMD_MODE_CAN,       /**< CAN mode command, such as "AT+CAN=<string>". */
    AT_CMD_MODE_INVALID    /**< The input command doesn't belong to any of the four types. */
} at_cmd_mode_Typedef;

typedef enum
{
    NOS_NUM, // 数字类型
    NOS_STR, // 字符串
} nos_Typedef;

typedef struct
{
    int param_count;                           /**< The response data buffer. */
    nos_Typedef param_types[param_count_max];   /**< The response data types. */
    double param_double[param_count_max];       /**< The input data buffer. */
    String param_string[param_count_max];       /**< The input string buffer. */
} at_cmd_param_t;

typedef struct
{
    String cmd_name; /**< The input name data buffer. */
    at_cmd_param_t cmd_param;    /**< The input param data buffer. */
    at_cmd_mode_Typedef mode;          /**< For more information, please refer to #atci_cmd_mode_t. */
} at_cmd_parse_t;

bool AT_Command_Processor(String cmd, at_cmd_parse_t *parse_cmd);
bool AT_Command_str2param(String param, at_cmd_param_t *cmd_param);
void str2d(String str, double *value);
double htoi(String s);
double btoi(String s);


#endif /* __AT_COMMAND_H__ */